package com.springStudy.beans.factory.config.demo;

import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

@Component
public class TestBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)  {
        String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
        System.out.println("load bean "+beanDefinitionNames);
        //如何这里直接去使用bean 会导致 TestBeanPostProcessor 这个bean失效?
//        for(String beanDefinitionName  : beanDefinitionNames){
//            System.out.println("TestBeanFactoryPostPorcessor : " + beanDefinitionName + " : " + beanFactory.getBean(beanDefinitionName));
//        }
        System.out.println("TestBeanFactoryPostPorcessor->postProcessBeanFactory");
    }
}